{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from skimage import io\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "num = 1\n",
    "\n",
    "\n",
    "def show():\n",
    "    global num\n",
    "\n",
    "\n",
    "    while (num < 5):\n",
    "        img = io.imread('/Users/meituan_sxw/PycharmProjects/tensorflow1.2/basic/pic/' + str(num) + '.jpeg')\n",
    "        io.imshow(img)\n",
    "        plt.ion()\n",
    "        plt.pause(0.01)\n",
    "        #input(\"Press Enter to Continue\")  # 之后改成识别输出\n",
    "        num += 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "JPEG (200, 110) RGB\n",
      "JPEG (200, 150) RGB\n",
      "JPEG (200, 150) RGB\n",
      "JPEG (200, 112) RGB\n",
      "JPEG (200, 112) RGB\n",
      "JPEG (200, 133) RGB\n",
      "JPEG (200, 132) RGB\n",
      "JPEG (200, 120) RGB\n",
      "JPEG (187, 150) RGB\n",
      "JPEG (200, 122) RGB\n",
      "JPEG (200, 133) RGB\n",
      "JPEG (200, 120) RGB\n",
      "JPEG (200, 124) RGB\n",
      "JPEG (200, 150) RGB\n",
      "JPEG (200, 124) RGB\n",
      "JPEG (200, 150) RGB\n",
      "JPEG (200, 141) RGB\n",
      "JPEG (200, 132) RGB\n",
      "JPEG (200, 113) RGB\n",
      "JPEG (200, 112) RGB\n",
      "JPEG (200, 110) RGB\n",
      "JPEG (200, 150) RGB\n",
      "JPEG (200, 124) RGB\n",
      "JPEG (200, 120) RGB\n",
      "JPEG (187, 150) RGB\n",
      "JPEG (187, 150) RGB\n",
      "JPEG (200, 124) RGB\n",
      "JPEG (200, 130) RGB\n",
      "JPEG (200, 112) RGB\n",
      "JPEG (200, 150) RGB\n",
      "JPEG (200, 124) RGB\n",
      "JPEG (200, 134) RGB\n",
      "JPEG (200, 144) RGB\n",
      "JPEG (200, 112) RGB\n",
      "JPEG (200, 112) RGB\n",
      "JPEG (200, 112) RGB\n"
     ]
    }
   ],
   "source": [
    "from PIL import Image\n",
    "import glob\n",
    "img_path = glob.glob(\"/Users/meituan_sxw/PycharmProjects/tensorflow1.2/basic/pic/*.jpeg\")\n",
    "path_save = \"/Users/meituan_sxw/PycharmProjects/tensorflow1.2/basic/pic\"\n",
    "for file in img_path:\n",
    "    name = os.path.join(path_save, file)\n",
    "    im = Image.open(file)\n",
    "    im.thumbnail((200,150))\n",
    "    print(im.format, im.size, im.mode)\n",
    "    im.save(name,'JPEG')\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "34\n",
      "35\n",
      "36\n"
     ]
    }
   ],
   "source": [
    "\n",
    "import matplotlib.pyplot as plt\n",
    "import imageio,os\n",
    "images = []\n",
    "num=34\n",
    "maxnum=36\n",
    "#filenames=sorted((fn for fn in os.listdir('/Users/meituan_sxw/PycharmProjects/tensorflow1.2/basic/pic/') if fn.endswith('.jpeg')))\n",
    "while (num <= maxnum):\n",
    "    print(num)\n",
    "    images.append(imageio.imread('/Users/meituan_sxw/PycharmProjects/tensorflow1.2/basic/pic/' + str(num) + '.jpeg'))\n",
    "    num += 1\n",
    "imageio.mimsave('wangqiuwangzi.gif', images,duration=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "python35",
   "language": "python",
   "name": "python35"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
